package com.huawei.appgallery.forum.posts.buoy.action;

import android.app.Activity;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.IOpenViewAction;
import com.huawei.appgallery.forum.comments.api.ICommentDetailProtocol;
import com.huawei.appgallery.forum.comments.api.ICommentDetailResult;
import com.huawei.appgallery.forum.message.api.ForumMessageHomeAction;
import com.huawei.secure.android.common.intent.SafeIntent;
import o.bqx;
import o.dys.a;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjc;

public class OpenPostCommentDetailAction extends IOpenViewAction {
    public static final String ACTION_OPEN_FORUM_POST_COMMENT = "com.huawei.appgallery.forum.comments.ACTION_OPEN_FORUM_POST_COMMENT";
    private static final String TAG = "OpenPostCommentDetailAction";
    private static c postCommentDetailCallBack;

    public interface c {
        void ˎ(ICommentDetailResult iCommentDetailResult);
    }

    public OpenPostCommentDetailAction(a aVar, SafeIntent safeIntent) {
        super(aVar, safeIntent);
    }

    public void onAction() {
        bqx.ˏ(TAG, "post comment detail action");
        if (this.callback instanceof Activity) {
            dispatchOpenPostCommentDetail();
        }
    }

    private void dispatchOpenPostCommentDetail() {
        if (this.callback instanceof Activity) {
            fjb ˎ = fho.ˏ().ˋ("Comments").ˎ("comment.detail.activity");
            ICommentDetailProtocol iCommentDetailProtocol = (ICommentDetailProtocol) ˎ.ˊ();
            iCommentDetailProtocol.setUri(this.intent.getExtras().getString("DetailId"));
            iCommentDetailProtocol.setSourceType(this.intent.getExtras().getInt(ForumMessageHomeAction.BUNDLE_SOURCETYPE));
            iCommentDetailProtocol.setNeedComment(this.intent.getExtras().getBoolean("NeedComment"));
            iCommentDetailProtocol.setDomainId(this.intent.getExtras().getString("DomainId"));
            iCommentDetailProtocol.setClickReplyView(this.intent.getExtras().getBoolean("ClickReplyView"));
            iCommentDetailProtocol.setCommentStatus(this.intent.getExtras().getInt("CommentStatus"));
            fiu.ˊ().ॱ((Activity) this.callback, ˎ, new fjc<ICommentDetailResult>(this) {
                final /* synthetic */ OpenPostCommentDetailAction ॱ;

                {
                    this.ॱ = r1;
                }

                public void ˎ(int i, ICommentDetailResult iCommentDetailResult) {
                    if (i == -1 && iCommentDetailResult != null) {
                        bqx.ˏ(OpenPostCommentDetailAction.TAG, "startCommentActivity onResult result.isLike:" + iCommentDetailResult.getLike() + ", result.getLikeCount:" + iCommentDetailResult.getLikeCount() + ", result.getReplyCount:" + iCommentDetailResult.getReplyCount());
                        OpenPostCommentDetailAction.notifyResult(iCommentDetailResult);
                    }
                }
            });
        }
    }

    public static synchronized void registerCall(c cVar) {
        synchronized (OpenPostCommentDetailAction.class) {
            postCommentDetailCallBack = cVar;
        }
    }

    private static synchronized void notifyResult(ICommentDetailResult iCommentDetailResult) {
        synchronized (OpenPostCommentDetailAction.class) {
            if (postCommentDetailCallBack != null) {
                postCommentDetailCallBack.ˎ(iCommentDetailResult);
            }
        }
    }
}
